home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pas_all.zip
/
TI424.ASC
< prev
next >
Wrap
Text File
|
1992-08-12
|
3KB
|
133 lines
PRODUCT : TURBO PASCAL NUMBER : 424
VERSION : 4.0
OS : MS-DOS, PC-DOS
DATE : APRIL 1, 1988 PAGE : 1/2
TITLE : MODIFYING THE ASPECT RATIO IN THE GRAPH UNIT
{****************************************************************
The .BGI files supplied with the Graph unit declare an Aspect
Ratio constant which is used to draw circles and arc segments.
For some applications it is necessary to alter the aspect ratio.
One such application results when trying to perform a screen dump
to the printer. In quad-density graphics printing, it is useful
to redefine the aspect ratio so the displayed results will be
circular instead of ellipsoid.
The following program demonstrates how a programmer can alter the
predefined Xasp element of the aspect ratio and to obtain the
current value. Note that the Graph unit already has the
procedure for GetAspectRatio.
****************************************************************}
program ChangeAspectRatio;
uses
Crt, Graph;
function GetAspectX : word;
{ Return the current aspect ratio element Xasp }
begin
GetAspectX := word(Ptr(Seg(GraphFreeMemPtr),
Ofs(GraphFreeMemPtr)+277)^);
end;
procedure SetAspectRatio(NewAspect : word);
{ Set the current aspect ratio element Xasp }
begin
word(Ptr(Seg(GraphFreeMemPtr),
Ofs(GraphFreeMemPtr)+277)^) := NewAspect;
end;
var
GraphDriver, GraphMode : integer;
Ch : char;
S : String;
begin
DirectVideo := false;
PRODUCT : TURBO PASCAL NUMBER : 424
VERSION : 4.0
OS : MS-DOS, PC-DOS
DATE : APRIL 1, 1988 PAGE : 2/2
TITLE : MODIFYING THE ASPECT RATIO IN THE GRAPH UNIT
GraphDriver := Detect;
InitGraph(GraphDriver, GraphMode, '');
Str(GetAspectX, S);
S := 'The initial aspect ratio was ' + S;
OutTextXY(1,1, S);
Circle((GetMaxX Div 2), (GetMaxY Div 4), (GetMaxY div 4));
SetAspectRatio(5000);
Circle((GetMaxX Div 2), 3*(GetMaxY Div 4), (GetMaxY div 4));
Str(GetAspectX, S);
S := 'Now the aspect ratio is ' + S;
OutTextXY(1,(GetMaxY - 10), S);
Ch := ReadKey;
CloseGraph;
end.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.